/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
 *
 * @author Logatti
 */
public class ConnectionMySQL {

    static String url = "jdbc:mysql://localhost/logatti";
    static String usuario = "root";
    static String senha = "";
    static Connection con;

    public static Connection getConnection() throws SQLException {

        try {
            Class.forName("com.mysql.jdbc.Driver");
            if (con == null) {
                con = DriverManager.getConnection(url, usuario, senha);
            }
            return con;
        } catch (ClassNotFoundException e) {
            throw new SQLException(e.getMessage());
        }
    }
}
